package com.itheima.demo;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        //1.设计一个电影类
        //2.设计一个电源操作类
        //3.准备一个电影数组，存放4部电影对象
        Movie[] movies = new Movie[4];
        movies[0] =new Movie(1,"肖申克的救赎",20.0,9.5,"弗兰克·德拉邦特","蒂姆·罗宾斯","摩根·弗里曼鲍");
        movies[1] =new Movie(2,"阿甘正传",20.0,9.5,"罗伯特·泽米吉斯","汤姆·汉克斯","罗宾·怀特");
        movies[2] =new Movie(3,"美丽人生",20.0,9.5,"罗伯托·贝尼尼","罗伯托·贝尼尼","乔治托·迪·卡斯特罗");
        movies[3] =new Movie(4,"盗梦空间",20.0,9.5,"克里斯托弗 诺兰","莱昂纳多·迪卡普里奥","约瑟夫·高登-莱维特");

       //4.创建一个电源操作类
        MovieOperator movieOperator = new MovieOperator(movies);
        /*movieOperator.printMovies();
        movieOperator.searchMovieById(1);*/
        Scanner sc =new Scanner(System.in);
        while (true) {
            System.out.println("==电影信息系统==");
            System.out.println("1.显示所有电影");
            System.out.println("2.根据编号查询电影详情信息");
            System.out.println("请您输入操作命令:");

            int command = sc.nextInt();
            switch (command){
                case 1:
                    movieOperator.printMovies();
                    break;
                case 2:
                    System.out.println("请您输入要查询的电影编号:");
                    int id = sc.nextInt();
                    movieOperator.searchMovieById(id);
                    break;
                default:
                    System.out.println("输入有误，请重新输入");
            }
        }
    }
}
